package com.macro.mall.service.impl;

import com.github.pagehelper.PageHelper;
import com.macro.mall.dto.PmsBrandParam;
import com.macro.mall.mapper.PmsBrandMapper;
import com.macro.mall.model.PmsBrand;
import com.macro.mall.model.PmsBrandExample;
import com.macro.mall.service.PmsBrandService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PmsBrandServiceImpl implements PmsBrandService {

    @Autowired
    private PmsBrandMapper pmsBrandMapper;


    @Override
    public int deleteByPrimaryKey(Long id) {
        return pmsBrandMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int deleteAll(List<Long> id) {
        return pmsBrandMapper.deleteAll(id);
    }

    @Override
    public int insertSelective(PmsBrandParam record) {
        PmsBrand pmsBrand = new PmsBrand();
        BeanUtils.copyProperties(record,pmsBrand);
        return pmsBrandMapper.insertSelective(pmsBrand);
    }

    @Override
    public List<PmsBrand> selectByExampleWithBLOBs(PmsBrandExample example) {
        return pmsBrandMapper.selectByExampleWithBLOBs(example);
    }

    @Override
    public List<PmsBrand> selectByExample(Integer pageSize, Integer pageNum) {
        PageHelper.startPage(pageNum,pageSize);
        return pmsBrandMapper.selectByExample(new PmsBrandExample());
    }

    @Override
    public PmsBrand selectByPrimaryKey(Long id) {
        return pmsBrandMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByExampleSelective(PmsBrandParam pms) {
        PmsBrand pmsBrand = new PmsBrand();
        BeanUtils.copyProperties(pms,pmsBrand);
        return pmsBrandMapper.updateByExampleSelective(pmsBrand);
    }

    @Override
    public int updateShow(PmsBrandParam record) {
        PmsBrand pmsBrand = new PmsBrand();
        BeanUtils.copyProperties(record,pmsBrand);
        return pmsBrandMapper.updateShow(pmsBrand);
    }

    @Override
    public int updateByPrimaryKeySelective(PmsBrandParam record) {
        PmsBrand pmsBrand = new PmsBrand();
        BeanUtils.copyProperties(record,pmsBrand);
        return pmsBrandMapper.updateByPrimaryKeySelective(pmsBrand);
    }
}
